package com.rxb.blog.controller;

import com.rxb.blog.common.CommonResult;
import com.rxb.blog.service.ArticleCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Author：rxb
 * Date：2020-03-14 22:36
 * Description：<描述>
 */
@RestController
@RequestMapping("comment")
public class ArticleCommentController {
    @Autowired
    private ArticleCommentService articleCommentService;

    /**
     * 内容评论
     * @param map
     * @return
     */
    @PostMapping("doComment")
    public CommonResult<String> doComment(@RequestBody Map map){
        articleCommentService.doComment(map);
        return CommonResult.success("评论成功");
    }

    //map参数封装了
    @PostMapping("getCommentList")
    public CommonResult<List<Map>> getCommentList(@RequestBody Map map){
        List<Map> list = articleCommentService.getCommentList(map);

        return CommonResult.success(list);
    }

    //评论的评论
    @PostMapping("doCommentToComment")
    public void doCommentToComment(@RequestBody Map map){
        articleCommentService.doCommentToComment(map);
    }


}
